import 'package:flutter/material.dart';
import 'package:hook_up_rent/pages/search/widgets/data.dart';
import 'package:hook_up_rent/routes/index.dart';
import 'package:hook_up_rent/widgets/common_floating_action_button.dart';
import 'package:hook_up_rent/widgets/room_list_item.dart';

class RoomManagePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 2,
      initialIndex: 0,
      child: Scaffold(
        appBar: AppBar(
          title: Text("房屋管理"),
          centerTitle: true,
          bottom: TabBar(
            tabs: [
              Tab(
                child: Text('已租'),
              ),
              Tab(
                child: Text('闲置'),
              )
            ],
          ),
        ),
        floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
        floatingActionButton: CommonFloatingActionButton('发布房源', () {
          Navigator.of(context).pushNamed(MyRoutes.roomAdd);
        }),
        body: TabBarView(
          children: [
            ListView(
              children: dataList.map((e) => RoomListItem(e)).toList(),
            ),
            ListView(
              children: dataList.map((e) => RoomListItem(e)).toList(),
            )
          ],
        ),
      ),
    );
  }
}
